﻿#include "page3widget.h"
#include "cppfont.h"

Page3Widget::Page3Widget() {

}

void Page3Widget::show() {

    showMemberData();

    int x, y;
    //等待触摸屏 触摸
    TouchSreen touch;
    touch.waitTouch(x, y);

    // 退出按钮，跳出当前商品页面，回到main widget
    if(x >= 0 && x < 120 && y >= 360 && y < 480) {
        CppFont::clearArea(120, 0, 680, 480, 0x00ffffff);  // 清空
        cout << "退出用户页面" << endl;
    }

}

void Page3Widget::showMemberData() {
    string buf;
    buf = "id:";
    string strTP = to_string(currentMember.id);
    buf.append(strTP);
    CppFont::displayCharacter(120, 20, (unsigned char *)buf.c_str(), 0x00000000, 2);

    buf = "name:";
    buf.append(currentMember.name);
    CppFont::displayCharacter(460, 20, (unsigned char *)buf.c_str(), 0x00000000, 2);

    buf = "account:";
    buf.append(currentMember.account);
    CppFont::displayCharacter(120, 90, (unsigned char *)buf.c_str(), 0x00000000, 2);

    buf = "password:";
    buf.append(currentMember.password);
    CppFont::displayCharacter(460, 90, (unsigned char *)buf.c_str(), 0x00000000, 2);

    buf = "sex:";
    buf.append(currentMember.sex);
    CppFont::displayCharacter(120, 160, (unsigned char *)buf.c_str(), 0x00000000, 2);

    buf = "level:";
    buf.append(currentMember.level);
    CppFont::displayCharacter(460, 160, (unsigned char *)buf.c_str(), 0x00000000, 2);

    buf = "email:";
    buf.append(currentMember.email);
    CppFont::displayCharacter(120, 230, (unsigned char *)buf.c_str(), 0x00000000, 2);

    buf = "phone:";
    buf.append(currentMember.phone);
    CppFont::displayCharacter(460, 230, (unsigned char *)buf.c_str(), 0x00000000, 2);

    buf = "address:";
    buf.append(currentMember.address);
    CppFont::displayCharacter(120, 300, (unsigned char *)buf.c_str(), 0x00000000, 2);
}
